const Item = {
    template: `
    <li>
        <slot name="left"></slot>
        <input v-if="ic" type="text" v-model="str" @blur="change">
        <span v-else @click="showIpt">{{str}}</span>
        <slot name="right"></slot>
    </li>`,
    props:{
        isChange:{},
        title:{default:"默认列表内容"},
        id:{}
    },
    data(){
        return {
            ic: false,
            str: "",
        }
    },
    created(){
        this.str = this.title;
    },
    watch:{
        isChange(v){
            this.ic = v;
        }
    },
    methods:{
        change(){
            this.ic = !this.ic;
            this.$emit("set", this.id, this.str);
        },
        showIpt(){
            this.ic = !this.ic;
        }
    },
    unmounted(){
        console.log("item组件被卸载")
    },
    mounted(){
        console.log("item组件被挂载")
    },
    activated(){
        console.log("item从缓存中插入组件")
    },
    deactivated(){
        console.log("item移除组件，移入缓存")
    }
}